<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');


if(!function_exists("_convert"))
{
	function _convert($data)
	{
		$CI =& get_instance();
		$CI->load->helper('url');
		if(is_numeric($data))
		{
			$sql = 'SELECT letter
						FROM grading_system
						WHERE (? >= range_start AND ? <= range_end )
						LIMIT 1';
			$q = $CI->db->query($sql,array(intval($data),intval($data)));
			return $q->num_rows() >= 1 ? '<strong>'.$q->row()->letter.'</strong>' : FALSE;

		}else{
			if(in_array(strtolower($data),['yellow','red','blue','green','orange']))
			{
				return '<img src="'.image_url('symb-'.$data.'.png').'" width="50">';
			}else{
				return $data;
			}
		}
	}
}